package OOPDemos;

/**
 * 面向对象(oop)编程基础
 */

public class Test1 {
    public static void main(String[] args) {

        //创建car对象,car1中存储的是地址
        Car car1 = new Car();
        //对象的成员变量
        car1.name = "迈凯伦";
        car1.price = 123.5;
        //输出对对象成员赋值的内容
        System.out.println(car1.name);
        System.out.println(car1.price);
        //调用对象中的方法
        car1.purchased();

        //声明其他的对象
        Car car2 = new Car();
        car2.name = "特斯拉";
        car2.price = 60.6;
        System.out.println(car2.name);
        System.out.println(car2.price);
        car2.onSale();
    }
}
